#! /usr/bin/env python
# -*- coding: utf-8 -*-

import logging

from CashStrategy.CashContext import CashContext
from CashStrategy.CashNormal import CashNormal
from CashStrategy.CashRebate import CashRebate
from CashStrategy.CashReturn import CashReturn


logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
                    datefmt='%a, %d %b %Y %H:%M:%S')


if __name__ == "__main__":
    money = 300.0
    strategy = {}
    strategy['normal'] = CashContext(CashNormal())
    strategy['rebate'] = CashContext(CashRebate(0.8))
    strategy['return'] = CashContext(CashReturn(300, 100))

    for ctype in strategy:
        cc = strategy[ctype]
        logging.info("[%s] you will pay:%d" % (ctype, cc.GetResult(money)))
